package com.zeyi.chat;

import com.zeyi.chat.handler.Dispatcher;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author zeyi
 */
public class MainApplication {
    private static final int PORT = 9001;

    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket(PORT);
            System.out.println("服务器已启动");
            while (true) {
                Socket socket = serverSocket.accept();
                new Dispatcher(socket).start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
